﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework;

using SunXNA.RainbowXNA;

namespace Darwin.Source.Components.World.Entities
{
    enum eBuildingState
    {
        _IDLE,
        _DEAD,
        _ATTACKING
    }

    abstract class CBuilding
    {
        protected int m_iHealth;
        protected int m_iDamage;
        protected Vector3 m_v3Position;
        protected eBuildingState m_bsBuildingState;

        protected CRainbowXNA.CRenderInstance m_instance;

        public UInt32 m_UID { get; protected set; }

        public Team.Side teamSide { get; set; }

        public CBuilding()
        {
            m_iHealth = 100;
            m_iDamage = 0;
            m_v3Position = new Vector3(0, 0, 0);
            m_bsBuildingState = eBuildingState._IDLE;

            m_UID = ++Components.World.World.m_UniversalID;
        }

        public abstract bool Initialise(CRainbowXNA.RenderObjectHandleType handle);
        public virtual void DoRender()
        {
            m_instance.CreateWorld(m_v3Position, Vector3.UnitZ, Vector3.One);
            Singleton<CRainbowXNA>.Instance.AddPotentialVisibleObject(m_instance);
        }

        public abstract void DoUpdate( GameTime e, World w );

        public int Health
        {
            get { return m_iHealth; }
            set { m_iHealth = value; }
        }

        public Vector3 Position
        {
            get { return m_v3Position; }
            set { m_v3Position = value; }
        }
        
    }
}
